package com.zhuss.controller.food;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.zhuss.bean.bo.food.food.CreateFoodBo;
import com.zhuss.bean.bo.food.food.DeleteFoodBo;
import com.zhuss.bean.bo.food.food.StartFoodBo;
import com.zhuss.bean.bo.food.food.StopFoodBo;
import com.zhuss.bean.bo.food.food.UpdateFoodBo;
import com.zhuss.common.BaseController;
import com.zhuss.common.OperateService;
import com.zhuss.exception.WpsException;
import com.zhuss.food.food.FoodOperateServiceExt;


/**
 * 餐品操作 controller
 * @Author zhushanshuo
   @Date 2020/02/28 16:01
 *
 */
  
 
@RestController
@RequestMapping("/food")
public class FoodOperateController extends BaseController {
	
	@Autowired
	@Qualifier("foodOperateService")
	private OperateService<Void, Object> foodOperateService;
	
	@Autowired
	@Qualifier("foodOperateServiceExt")
	private FoodOperateServiceExt foodOperateServiceExt;
	
	/**
	 * 创建
	 * @param bo
	 * @throws WpsException
	 */
	@ResponseBody
    @PostMapping("/create")
    public void create(@RequestBody CreateFoodBo bo) throws WpsException {
		
		foodOperateService.create(bo);
    }
	
	
	/**
	 * 修改
	 * @param bo
	 * @throws WpsException
	 */
	@ResponseBody
    @PostMapping("/update")
    public void update(@RequestBody UpdateFoodBo bo) throws WpsException {
		
		foodOperateService.update(bo);
    }
	
	/**
	 * 删除
	 * @param bo
	 * @throws WpsException
	 */
	@ResponseBody
    @PostMapping("/delete")
    public void delete(@RequestBody DeleteFoodBo bo) throws WpsException {
		
		foodOperateService.delete(bo);
    }
	
	
	/**
	 * 启用
	 * @param bo
	 * @throws WpsException
	 */
	@ResponseBody
    @PostMapping("/start")
    public void start(@RequestBody StartFoodBo bo) throws WpsException {
		
		foodOperateServiceExt.start(bo);
    }
	
	
	/**
	 * 停用
	 * @param bo
	 * @throws WpsException
	 */
	@ResponseBody
    @PostMapping("/stop")
    public void stop(@RequestBody StopFoodBo bo) throws WpsException {
		
		foodOperateServiceExt.stop(bo);
    }
	
}
